package net.llz.mapper;

import net.llz.model.RoleDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Let_fan
 * @since 2022-10-08
 */
public interface RoleMapper extends BaseMapper<RoleDO> {


//    @Select("select ur.role_id as id, " +
//            "r.name as name, " +
//            "r.description as description " +
//            " from  user_role ur left join role r on ur.role_id = r.id " +
//            "where  ur.user_id = #{userId}")
//    @Results(
//            value = {
//                    @Result(id=true, property = "id",column = "id"),
//                    @Result(property = "name",column = "name"),
//                    @Result(property = "description",column = "description"),
//                    @Result(property = "permissionList",column = "id",
//                            many = @Many(select = "shiro-service/src/main/java/net/llz/mapper/PermissionMapper.findPermissionListByRoleId", fetchType = FetchType.DEFAULT)
//                    )
//            }
//    )
    List<RoleDO> findRoleListByUserId(@Param("userId") Integer userId);
}
